package main

import (
	"FileScanner/utils"
	"flag"
	"fmt"
	"os"
)

// https://www.cnblogs.com/believepd/p/10952528.html
// -t list|walk -l path

func main() {
	if len(os.Args) < 2 {
		fmt.Println("缺少必需的参数!")
		os.Exit(1)
	}

	var opType string
	var path string
	flag.StringVar(&opType, "t", "list", "Operate Type: [list|walk|scan]")
	flag.StringVar(&path, "l", "", "Path")
	flag.Parse()
	if opType == "walk" {
		utils.MapIter(utils.WalkDir(path))
	} else if opType == "scan" {
		utils.ScanDir(path)
	} else {
		utils.SliceIter(utils.ListDir(path))
	}

	/*
		else {
			fmt.Println()
			path := os.Args[1] // 0 是 程序本身
			utils.ListIter(utils.ListDir(path))
			}
	*/
}
